<?xml version="1.0" encoding="UTF-8"?>
<root>
    {% for section in tree.getlist() %}
    <section{{ section.description | xmlattr }}>
        {% for category in section.getlist() %}
        <category{{ category.description | xmlattr }}>
            {% for item in category.products %}
            <item id="{{ item.get('itemid') }}">
                {% for tag, value in item.description.items() -%}
                <attribute name="{{ tag }}">{{ value }}</attribute>
                {% endfor -%}
                <presencemap>
                    {% for store, presence in item.presence.items() -%}
                    <store id="{{ store }}" available="{{ presence.0 }}" onsale="{{ presence.1 }}"/>
                    {% endfor -%}
                </presencemap>
            </item>
            {% endfor %}
        </category>
        {% endfor %}
    </section>
    {% endfor %}
</root>
